function [ resp EMC errorTotal NO_PASO_1 NO_PASO_0] = generalize( net, trainingPatterns, trainingResults, activationFn, BETA )
%HASLEARNED Summary of this function goes here
%   Detailed explanation goes here
    global TOLERANCE;

    errorTotal = 0;
    passed = 0;
    EMC = 0;
    NO_PASO_1 = 0;
    NO_PASO_0 = 0;
    for i = 1:size(trainingPatterns,1)
        eval = netEvaluate(net, trainingPatterns(i,:), activationFn, BETA);
        train = trainingResults(i,:);
      

        local_error = abs(eval-train);

        EMC = EMC + local_error*local_error;
        errorTotal = errorTotal + local_error;

        if(local_error < TOLERANCE)
            passed = passed+1;
        else
            if( train == 1)
                NO_PASO_1 = NO_PASO_1 + 1;
            else
                NO_PASO_0 = NO_PASO_0 + 1;
            end
        end
    end
    resp = passed;
    EMC = sqrt(EMC / i);
end